#ifndef JNUMITEMSCROLL_H
#define JNUMITEMSCROLL_H

#include "QTEGui/qteguiglobal.h"
#include <QFrame>

namespace QTE
{

class JNumItemScrollPrivate;

class QTEGUI_EXPORT JNumItemScroll : public QFrame
{
	Q_OBJECT
    Q_PROPERTY(qreal currentValue READ currentValue WRITE setValue NOTIFY currentValueChanged)

public:
	explicit JNumItemScroll(QWidget *parent = nullptr);
	JNumItemScroll(qreal min, qreal max, bool upperEndAdjusting = true, QWidget *parent = nullptr);
	JNumItemScroll(qreal precision, qreal min, qreal max, bool upperEndAdjusting = true, QWidget *parent = nullptr);
	~JNumItemScroll();

public:
	qreal precision() const;

	qreal minimumValue() const;
	qreal maximumValue() const;

	qreal currentValue() const;
	bool gestureEnabled() const;

public Q_SLOTS:
	void setPrecision(qreal precision, bool upperEndAdjusting = true);
	void setRange(qreal min, qreal max, bool upperEndAdjusting = true);

	void setMinimumValue(qreal min);
	void setMaximumValue(qreal max);

	void setValue(qreal value);
	void setGestureEnabled(bool enable);

Q_SIGNALS:
	void currentValueChanged(qreal value);

protected:
	void wheelEvent(QWheelEvent *event) override;
	void paintEvent(QPaintEvent *event) override;
	void changeEvent(QEvent *event) override;

protected:
	virtual QFont paintNum(QPainter &painter, qreal num, int deviation);

private:
	JNumItemScrollPrivate *d_ptr;
	Q_DISABLE_COPY(JNumItemScroll)
};

} //namespace QTE


#endif //JNUMITEMSCROLL_H
